import fetch from './index.js'

var that;
export const initFun = (THIS) => {
	that = THIS
	console.log(that)
}

//登录
export const login = (username, password, captcha) => fetch('user/login/dologin', {
	username,
	password,
	captcha
})

//登出
export const loginOut = () => fetch('user/login/loginout')

//支付密码验证
export const paymentPass = (user_pass) => fetch('user/trade/confirmUserPassword',{
	user_pass
})

//首页
export const banner = () => fetch('user/hall/banner')

//获取用户信息
export const getUserInfo = () => fetch('user/login/getUserInfo')

//修改登录密码
export const editLoginPass = (username, mobile, newpwd, confirmpwd, code, type) => fetch('api/userapi.php', {
	act: 'editpwd',
	username,
	mobile,
	newpwd,
	confirmpwd,
	code,
	type
})

//规则
export const rule = () => fetch('index.php/portal/article/getTradeArticle')

//交易大厅 - 求购 - 确定购买
export const receiptSellerOut = (id, trade_type) => fetch('user/trade/receiptSellerOut', {
	id,
	trade_type
});
//交易大厅 - 出售 - 确定购买
export const receiptTradeIn = (id, trade_type) => fetch('user/trade/receiptTradeIn', {
	id,
	trade_type
})

//折线图
export const lineData = (conditions) => fetch('/home/trade_price/index', {
	conditions
})

//验证码 写入 cookies
export const loginIndex = () => fetch('user/login/index')

//买入 - 获取验证码
export const buy = () => fetch('user/trade/tradein')

//我的委托 - 买入 - 提交
export const tradeInSubmit = (price, buyQty, buyCaptchaCode, transform_wallet) => fetch('user/trade/tradeInSubmit', {
	price,
	buyQty,
	transform_wallet,
	buyCaptchaCode
})

//获取收款详细信息是否完整
export const isReceiptInfo = () => fetch('user/Profile/getuserinfo')

//获取收款详细信息
export const getReceiptInfo = () => fetch('user/Profile/center')

//修改收款信息
export const editReceiptInfo = (mobile, wechat, alipay, bank, bank_name, bank_user) => fetch('user/Profile/editPost', {
	mobile,
	wechat,
	alipay,
	bank,
	bank_name,
	bank_user
})

//买入 - 获取验证码
export const tradeSellerOut = () => fetch('user/trade/tradeSellerOut')

//交易大厅 - 求购
export const buying = (page) => fetch('user/hall/tradeIn', {
	page,
	pagesize: 10
}, 'GET')

//交易大厅 - 出售
export const sell = () => fetch('user/hall/sellerOut', {}, 'GET')

//交易大厅 - 买出 - 提交
export const tradeSellerOutSubmit = (price, saleQty, saleCaptchaCode) => fetch('user/trade/tradeSellerOutSubmit', {
	price,
	saleQty,
	saleCaptchaCode
})

//交易大厅 - 委托 - 买入
export const myTradeIn = () => fetch('user/trade/myTradeIn')

//交易大厅 - 委托 - 卖出
export const myTradeSellerOu = () => fetch('user/trade/myTradeSellerOut')

//交易大厅 - 确认 - 买方
export const complateTrade = () => fetch('user/trade/myComplateTradeIn')

//交易大厅 - 确认 - 卖方
export const complateTradeSellerOut = () => fetch('user/trade/myComplateTradeSellerOut')

//交易大厅 - 确认 - 确认放行
export const release = (id) => fetch('user/trade/toTransferAccount', {
	id
})

//公告列表
export const articleLists = () => fetch('portal/article/lists')
//公告详情
export const articleDetails = (id) => fetch('portal/article/details', {
	id
})

//上传文件
export const updata = (data, type, config) => fetch('user/trade/toComplateMyTradeInSubmit', data, 'POST', type, config)

export const getUsreOrders = (id) => fetch('user/trade/viewTheTrdeinfo', {
	id
})

//发送验证码
export const sendCode = (username, mobile) => fetch('api/userapi.php', {
	act: 'getMobileCode',
	username,
	mobile
})

//工单列表
export const listgongdan = () => fetch('home/gongdan/listgongdan', {})

//提交工单
export const addGongdan = (formData) => fetch('home/gongdan/addGongdan', formData,'POST','1')

// 交易记录
export const trding = (page,type) => fetch('home/trade/listTrade',{
    page,
    type
})

// 买/卖单详情
export const mDetail = (id,type) => fetch('home/trade/infoTrade',{
    id,
    type
})

// qian bao
export const money = () => fetch('user/profile/getasset',{})

export const phoneSendCode = 1

//发送验证码
export const sendCodeInfo = (mobile,type) => fetch('user/Profile/getCode',{
	mobile,
	type
})

//验证验证码
export const visCode = (mobile, code, type) => fetch('user/Profile/verify',{
	mobile,
	code,
	type
})
